package com.gydz.gydzbaseframeworkboot.Common.utils.sqlUtil.service.impl;

import com.gydz.gydzbaseframeworkboot.Common.utils.sqlUtil.domain.TableSelect;
import com.gydz.gydzbaseframeworkboot.Common.utils.sqlUtil.dao.SqlUtilMapper;
import com.gydz.gydzbaseframeworkboot.Common.utils.sqlUtil.service.SqlUtilsService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("SqlUtilsService")
public class SqlUtilsServiceImpl implements SqlUtilsService {

    @Autowired
    SqlUtilMapper sqlUtilMapper;

    @Override
    public boolean tableExist(String tableName) {
        if(StringUtils.isBlank(tableName)){
            return false;
        }
        return StringUtils.isNotBlank(sqlUtilMapper.tableExist(tableName));
    }

    @Override
    public List<String> selectTabeName(TableSelect tableSelect) {
        return sqlUtilMapper.selectTabeName(tableSelect);
    }


}
